package org.xiyu.yee.pjwto;

import net.minecraftforge.event.server.ServerStartedEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.loading.FMLPaths;
import org.xiyu.yee.pjwto.config.PiglinTradeConfig;
import org.xiyu.yee.pjwto.event.ServerEventHandler;

@Mod(Constants.MOD_ID)
public class Pjwto {

    public Pjwto() {
        // This method is invoked by the Forge mod loader when it is ready
        // to load your mod. You can access Forge and Common code in this
        // project.

        // Use Forge to bootstrap the Common mod.
        Constants.LOG.info("Hello Forge world!");
        CommonClass.init();
        
        // 加载配置文件
        PiglinTradeConfig.loadConfig(FMLPaths.CONFIGDIR.get().toFile());
        
        // 注册事件处理器
        net.minecraftforge.common.MinecraftForge.EVENT_BUS.register(this);
    }
    
    @SubscribeEvent
    public void onServerStarted(ServerStartedEvent event) {
        ServerEventHandler.onServerStarted(event.getServer());
    }
}
